<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('车辆类别列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
                    <input type="hidden" id="vehicleId" name="vehicleId" th:value="${vehicleId}"/>
					<div class="select-list">
						<ul>
							<li>
								类别名称：<input type="text" name="categoryName" maxlength="10"/>
							</li>


							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="toPass()">
					<i class="fa fa-plus"></i> 添加
				</a>

			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">

        var prefix = ctx + "base/baseCategory";

        function toPass() {
            var vehicleId = $("#vehicleId").val();
            var url = prefix +"/pass/"+vehicleId;
            $.modal.open("新增车型类别", url, '700', '300');
        }

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
				removeUrl: prefix + "/remove",
                modalName: "车辆类别",
                columns: [
				{
					field : 'categoryName',
					title : '类别名称',
					align: 'center'

				},

				{
					field : 'createTime',
					title : '创建时间',
					sortable: true,
					align: 'center'
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
						actions.push('<a class="btn btn-success btn-xs  href="javascript:void(0)" onclick="editCategory(\'' + row.id + '\')"><i class="fa fa-edit"></i>重命名</a> ');
                        actions.push('<a class="btn btn-danger btn-xs  href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });


		function editCategory(id) {
			var url = prefix + "/edit/"+id;
			$.modal.open("重命名", url, '700', '300');
		}
    </script>
</body>
</html>